package com.game.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.game.pojo.po.MapResources;
import com.game.dao.MapResourcesDao;
import com.game.service.MapResourcesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 地图资源 服务实现类
 * </p>
 *
 * @author lvhao
 * @since 2020-07-26
 */
@Service
public class MapResourcesServiceImpl extends ServiceImpl<MapResourcesDao, MapResources> implements MapResourcesService {
    @Autowired
    private MapResourcesDao mapResourcesDao;

    @Override
    public List<MapResources> getByMapId(int mapId) {
        QueryWrapper<MapResources> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("map_id",mapId);
        return mapResourcesDao.selectList(queryWrapper);
    }

    @Override
    public List<MapResources> getByMapIdAndTypeId(int mapId, int mapResourcesTypeId) {
        QueryWrapper<MapResources> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("map_id",mapId);
        queryWrapper.eq("map_resources_type_id",mapResourcesTypeId);
        return mapResourcesDao.selectList(queryWrapper);
    }
}
